<template>
	<div class="iframe-body-sty">
			<iframe id="iframe-shrink" src="https://top.baidu.com/board?platform=pc&sa=pcindex_entry" width="100%" height="100%"></iframe>
	</div>
</template>

<script>
	export default {
		data() {
			return {}
		},
		mounted() {
			/**
			 * iframe-宽高自适应显示
			 */
			function changeMobsfIframe() {
				const mobsf = document.getElementById('iframe-shrink');
				const deviceWidth = document.body.clientWidth;
				const deviceHeight = document.body.clientHeight;
				mobsf.style.width = (Number(deviceWidth) - 0) + 'px'; //数字是页面布局宽度差值
				mobsf.style.height = (Number(deviceHeight) - 0) + 'px'; //数字是页面布局高度差
			}

			changeMobsfIframe()

			window.onresize = function() {
				changeMobsfIframe()
			}
      document.querySelector("#title_1").innerHTML = iframe.contentWindow.window.location;
		},
		// head() {
		//   return {
		//     meta: [{
		//       hid: 'description',
		//       'http-equiv': 'Content-Security-Policy',
		//       content: 'upgrade-insecure-requests'
		//     }]
		//   }
		// },
	}
</script>
<style>
	.iframe-body-sty {
		position: relative;
		overflow: hidden;
		margin-left: -20px;
		margin-top: -25px;
		height: 600px;
		width: 1250px;
		/* background-color: red; */
	}

	.iframe-body-sty>#iframe-shrink {
		position: absolute;
		transform: scale(0.8);
		left: -155px;
		top: -72px;
	}
</style>
